package com.example.holes;

import java.util.ArrayList;

import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Align;

public class EnemyInfo {
	private Bitmap bg;
	private Paint numbers = new Paint();
	private Paint name = new Paint();
	private String nameText;
	private ArrayList<Bitmap> images;
	private Bitmap enemy_image;
	private String health, points, attack;
	private final int bgLeft, bgTop, enemyLeft, enemyTop, nameLeft,
				nameTop, healthLeft, healthTop, pointsLeft,
				pointsTop, attackLeft, attackTop;
	
	public EnemyInfo(Bitmap bg, ArrayList<Bitmap> images){
		// set and scale coords according to screen size
		bgLeft = 0;
		bgTop = (int)(64 * Global.SCALE_RATIO_H);
		enemyLeft = (int)(320 * Global.SCALE_RATIO_W);
		enemyTop = (int)(130 * Global.SCALE_RATIO_H);
		nameLeft = (int)(400 * Global.SCALE_RATIO_W);
		nameTop = (int)(120 * Global.SCALE_RATIO_H);
		healthLeft = (int)(303 * Global.SCALE_RATIO_W);
		healthTop = (int)(355 * Global.SCALE_RATIO_H);
		pointsLeft = (int)(393 * Global.SCALE_RATIO_W);
		pointsTop = (int)(355 * Global.SCALE_RATIO_H);
		attackLeft = (int)(478 * Global.SCALE_RATIO_W);
		attackTop = (int)(355 * Global.SCALE_RATIO_H);
		
		this.bg = bg;
		this.images = images;
		numbers.setColor(Color.BLACK);
		numbers.setTextSize(30);
		numbers.setTextAlign(Align.CENTER);
		name.setColor(Color.BLACK);
		name.setTextSize(50);
		name.setTextAlign(Align.CENTER);
	}
	
	public void Draw(Canvas c){
		c.drawBitmap(bg, bgLeft, bgTop, null);
		c.drawBitmap(enemy_image, enemyLeft, enemyTop, null);
		c.drawText(nameText, nameLeft, nameTop, name);
		c.drawText(health, healthLeft, healthTop, numbers);
		c.drawText(points, pointsLeft, pointsTop, numbers);
		c.drawText(attack, attackLeft, attackTop, numbers);
	}
	
	public void setEnemy(int level){
		switch (level){
			case 1:	nameText = "Mole";
					health = "1";
					points = "10";
					attack = "-10";
					enemy_image = images.get(0);
					break;
			case 2: nameText = "Mole";
					health = "1";
					points = "10";
					attack = "-10";
					enemy_image = images.get(0);
					break;
			case 3: nameText = "Turtle";
					health = "2";
					points = "20";
					attack = "-15";
					enemy_image = images.get(1);
					break;
			case 4: nameText = "Turtle";
					health = "2";
					points = "20";
					attack = "-15";
					enemy_image = images.get(1);
					break;
			case 5: nameText = "Bomb";
					health = "X";
					points = "0";
					attack = "-25";
					enemy_image = images.get(2);
					break;
			case 6: nameText = "Bomb";
					health = "X";
					points = "0";
					attack = "-25";
					enemy_image = images.get(2);
					break;
			case 7: nameText = "Bomb";
					health = "X";
					points = "0";
					attack = "-25";
					enemy_image = images.get(1);
					break;
			case 8: nameText = "Porcupine";
					health = "1";
					points = "25";
					attack = "10";
					enemy_image = images.get(8);
					break;
			case 9: nameText = "Porcupine";
					health = "1";
					points = "25";
					attack = "10";
					enemy_image = images.get(6);
					break;
			case 10: nameText = "Porcupine";
					health = "1";
					points = "25";
					attack = "10";
					enemy_image = images.get(5);
					break;
		}
	}
}
